﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Color x:Key="HighlightedBackgroundColor">#45FFFFFF</Color>
    <Color x:Key="PressedBackgroundColor">#A0FFFFFF</Color>
    <Color x:Key="ControlBorderColor">#FFFFFFFF</Color>
    <Color x:Key="GlyphColor">#FFFFFFFF</Color>

    <Style TargetType="CheckBox">
        <Setter Property="Foreground" Value="White" />
        <Setter Property="SnapsToDevicePixels" Value="true" />
        <Setter Property="OverridesDefaultStyle" Value="true" />
        <Setter Property="FocusVisualStyle" Value="{DynamicResource CheckBoxFocusVisual}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type CheckBox}">
                    <BulletDecorator Background="Transparent">
                        
                        <BulletDecorator.Bullet>
                            <Border x:Name="Border"
                                    Width="14" Height="14"
                                    CornerRadius="1" BorderThickness="1">
                                <Border.BorderBrush>
                                    <SolidColorBrush Color="{StaticResource ControlBorderColor}" />
                                </Border.BorderBrush>
                                <Border.Background>
                                    <SolidColorBrush Color="Transparent" />
                                </Border.Background>
                                <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                                    <Path x:Name="CheckMark"
                                          Visibility="Collapsed" Width="8" Height="8"
                                          SnapsToDevicePixels="False"
                                          StrokeThickness="2"
                                          Data="M 0 4 L 3 8 M 3 8 L 8 0">
                                        <Path.Stroke>
                                            <SolidColorBrush Color="{DynamicResource GlyphColor}" />
                                        </Path.Stroke>
                                    </Path>
                                    <Path x:Name="InderminateMark"
                                          Visibility="Collapsed" Width="8" Height="8"
                                          SnapsToDevicePixels="False"
                                          StrokeThickness="2"
                                          Data="M 0 8 L 8 0">
                                        <Path.Stroke>
                                            <SolidColorBrush Color="{DynamicResource GlyphColor}" />
                                        </Path.Stroke>
                                    </Path>
                                </Grid>
                            </Border>
                        </BulletDecorator.Bullet>

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Duration="00:00:00.25" Storyboard.TargetName="Border" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource HighlightedBackgroundColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)">
                                            <EasingColorKeyFrame KeyTime="0" Value="{StaticResource PressedBackgroundColor}" />
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled" />
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="CheckStates">
                                <VisualState x:Name="Checked">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="CheckMark">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Unchecked" />
                                <VisualState x:Name="Indeterminate">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="InderminateMark">
                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <ContentPresenter Margin="4,0,0,0"
                                          VerticalAlignment="Center"
                                          HorizontalAlignment="Left"
                                          RecognizesAccessKey="True" />
                    </BulletDecorator>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>